<%@include file="/WEB-INF/templates/configuration.jsp" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="windows-1252"%>

<h2>${pageTitle}</h2>
<c:if test="${not empty foutMelding}">
    <!-- Mochten er foutmeldingen zijn, dan worden ze hier getoond -->
    <p>${foutMelding}</p>
</c:if>
<c:choose>
    <c:when test="${empty course.courseid}">
        <!-- Als er geen id is meegegeven, ga je een cursus toevoegen -->
        <form id="nieuweCursus" action="new" method="post">
        </c:when>
        <c:otherwise>
            <!-- Anders ga je een gebruiker wijzigen -->
            <form id="wijzigenCursus" action="edit" method="post">
            </c:otherwise>
        </c:choose>
        <p>
            <c:if test="${not empty course.courseid}">
                <!-- Het id wordt meegestuurd, om te bepalen welke cursus je gaat wijzigen -->
                <input type="hidden" name="courseid" id="courseid" value="${course.courseid}"></input>
            </c:if>
        <table border="0">
            <tr>
                <td><label for="coursetitle">Course Title</label></td>
                <td><input type="textfield" id="coursetitle" name="coursetitle" value="${course.coursetitle}"></input></td>
            </tr>
            <tr>
                <td><label for="coursedescription">Course Description</label></td>
                <td><textarea rows="8" cols="50" id="coursedescription" class="mceEditor" name="coursedescription">${course.coursedescription}</textarea></td>
            </tr>
            <tr>
                <td><label for="coursepicture">Course Picture</label></td>
                <td><input type="textfield" id="coursepicture" name="coursepicture" value="${course.coursepicture}"></input></td>
            </tr>
            <tr>
                <td> <label for="coursecategory">Course category:</label></td>
                <td>
                    <select name="coursecategory">
                        <option value="0">Languages</option>
                        <option value="1">Exact Subjects</option>
                        <option value="2">Cooking</option>
                        <option value="3">Programming</option>
                        <option value="4">Social</option>
                        <option value="5">Recreation</option>
                        <option value="6">Managing</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td> <label for="teacherlist">Head teacher:</label></td>
                <td>
                    <select name="teacherlist">
                        <c:forEach var="tempTeacher" items="${teachers}">
                            <option value="${tempTeacher.userName}">${tempTeacher.userName}</option>
                        </c:forEach>
                    </select>
                </td>
            </tr>
        </table>
        </p>
        <p>
            <input class="submit" type="submit" value="${buttonTitle}">
        </p>
    </form>